{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "ce1bbcde-bc7a-47e9-93f4-f16070861419",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/substring-with-concatenation-of-all-words\n",
    "\n",
    "\n",
    "Memory Limit Exceeded, 151 / 176 test cases passed.\n",
    "\n",
    "\n",
    "```python\n",
    "from itertools import permutations\n",
    "\n",
    "class Solution:\n",
    "    def findSubstring(self, s: str, words: List[str]) -> List[int]:\n",
    "        #8:56\n",
    "        wordsPermutations = [\"\".join(one) for one in permutations(words)]\n",
    "        totalLength = len(s)\n",
    "        targetLength = len(\"\".join(words))\n",
    "        results = []\n",
    "        for i, _ in enumerate(s):\n",
    "            if (totalLength - i + 1) > targetLength:\n",
    "                temp = s[i:i+targetLength] \n",
    "                if any([one==temp for one in wordsPermutations]):\n",
    "                    results.append(i)\n",
    "            else:\n",
    "                break\n",
    "        return results\n",
    "        #9:02\n",
    "        #debug until 9:05, Memory Limit Exceeded, 151 / 176 test cases passed.\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f3c3d0ed-23da-44cf-95cd-9372d1a1c161",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
